﻿package baidu.reader.common.ui.toc
{
    import baidu.reader.common.ui.components.*;
    import baidu.ui.containers.*;
    import flash.text.*;

    public class ToCItemButton extends Pane
    {
        private var bulletColor:uint = 7035468;
        private var bulletSize:Number = 3;
        private var firstColor:uint = 1118481;
        private var secondColor:uint = 10450001;
        private var padding:Number = 20;
        private var fontSize:int = 14;
        private var _value:Object;
        private var _ellipsisIndex:int = -1;
        private var _tail:String = "...";
        private var _text:String;
        private var button:EllipsisLabelButton;

        public function ToCItemButton(param1:String = "")
        {
            this.button = new EllipsisLabelButton();
            this.button.height = this.fontSize + 8;
            this.button.setStyle("skin", TabRadioButton_Skin);
            this.button.setStyle("textFormat", new TextFormat("宋体", 14, 3355443));
            this.button.autoSize = true;
            this.button.useHandCursor = true;
            this.button.textField.autoSize = TextFieldAutoSize.LEFT;
            addChild(this.button);
            this.button.x = this.padding;
            this.graphics.beginFill(this.bulletColor);
            this.graphics.drawRect(10, 10, this.bulletSize, this.bulletSize);
            this.label = param1;
            return;
        }// end function

        override public function set width(param1:Number) : void
        {
            super.width = param1;
            this.drawNow();
            this.resizeButton();
            return;
        }// end function

        public function set label(param1:String) : void
        {
            this._text = param1;
            this.button.label = this._text;
            this.refreshLabelColor();
            this.drawNow();
            this.resizeButton();
            return;
        }// end function

        public function get label() : String
        {
            return this._text;
        }// end function

        private function resizeButton() : void
        {
            this.button.width = this.width - this.padding;
            return;
        }// end function

        private function refreshLabelColor() : void
        {
            return;
        }// end function

        public function get value()
        {
            return this._value;
        }// end function

        public function set value(param1) : void
        {
            this._value = param1;
            return;
        }// end function

    }
}
